<title>金惠智保</title>

<div class="layui-fluid">
  <div class="layui-card">
    <div class="layui-card-body">

      <!-- 爆款设置 -->
      <div class="layui-row layui-col-space20">
        <div class="layui-col-md6">
          <div class="LAY_wisdom_title">
            <h3 class="LAY_wisdom_title_line">爆款设置</h3>
          </div>

          <div class="layui-row LAY_wisdom_list_row">
            <div class="layui-col-md10 layui-col-md-offset2">
              <div class="list-group col LAY_wisdom_scroll" id="LAY_hot_list_view"></div>

              <script type="text/html" id="LAY_hot_list_tpl">
                {{# if (d.length) { }}
                {{# layui.each(d, function(index, item){ }}
                <div class="list-group-item LAY_wisdom_list_warp" data-code="{{item.productCode}}"
                     data-name="{{item.productName}}" data-sort="">
                  <div class="LAY_wisdom_list_item{{item.active ? ' active' : ''}}">
                    {{item.productName}}
                  </div>
                  <div class="LAY_wisdom_list_btn_group">
                    <div class="LAY_wisdom_list_btn_up LAY_hot_list_btn_up" data-code="{{item.productCode}}"
                         data-index="{{index}}">
                      <i class="layui-icon layui-icon-up"></i>
                    </div>
                    <div class="LAY_wisdom_list_btn_delete LAY_color_red LAY_hot_list_btn_delete"
                         data-code="{{item.productCode}}">
                      <i class="layui-icon layui-icon-delete"></i>
                    </div>
                    <div class="LAY_wisdom_list_btn_down LAY_hot_list_btn_down" data-code="{{item.productCode}}"
                         data-index="{{index}}">
                      <i class="layui-icon layui-icon-down"></i>
                    </div>
                  </div>
                </div>
                {{# }) }}
                {{# } else { }}
                <div class="LAY_empty">暂无数据</div>
                {{# } }}
              </script>
            </div>
          </div>
        </div>
        <div class="layui-col-md6">
          <div class="LAY_wisdom_title">
            <h3>产品库</h3>
          </div>

          <div class="LAY_wisdom_product_search">
            <form class="layui-form LAY_wisdom_product_search_form" lay-filter="LAY_wisdom_product_search_form">
              <input type="text" name="productName" placeholder="请输入产品名称" autocomplete="off" class="layui-input">
              <button lay-submit class="layui-btn" lay-submit lay-filter="LAY_wisdom_product_search_btn">
                <i class="layui-icon layui-icon-search"></i>
              </button>
            </form>
          </div>

          <div class="LAY_wisdom_list_view" id="LAY_wisdom_product_list_view"></div>

          <script type="text/html" id="LAY_wisdom_product_list_tpl">
            <form class="layui-form" lay-filter="LAY_wisdom_product_list_form">
              {{# if (d && d.length) { }}
              {{# layui.each(d, function(index, item){ }}
              <div class="LAY_wisdom_product_list_row">
                <div class="LAY_wisdom_product_list_checkbox LAY_wisdom_product_list_square"></div>
                <div class="LAY_wisdom_product_list_card">
                  {{item.productName}}
                </div>
                <div class="LAY_wisdom_product_list_button">
                  <button type="button" class="layui-btn LAY_hot_add" data-name="{{item.productName}}"
                          data-code="{{item.productCode}}">
                    <i class="layui-icon layui-icon-addition"></i>
                  </button>
                </div>
              </div>
              {{# }) }}
              {{# } else { }}
              <div class="LAY_empty">暂无数据</div>
              {{# } }}
            </form>
          </script>
        </div>
      </div>

      <hr style="margin-top: 30px;">

      <!-- 产品中心 -->
      <div class="layui-row layui-col-space20">
        <div class="layui-col-md6">
          <div class="LAY_wisdom_title">
            <h3 class="LAY_wisdom_title_line">产品中心</h3>
          </div>

          <div class="layui-row LAY_wisdom_list_row">
            <div class="layui-col-md2">
              <div class="layui-tab layui-tab-brief" lay-filter="LAY_product_center_tab">
                <ul class="layui-tab-title LAY_product_center_tab_title" id="LAY_product_center_tab_view"></ul>

                <script type="text/html" id="LAY_product_center_tab_tpl">
                  {{#  layui.each(d, function(index, item){ }}
                  <li class="{{index == 0 ? 'layui-this' : ''}}" data-code="{{item.categoryCode}}">{{ item.name }}</li>
                  {{#  }); }}
                </script>
              </div>
            </div>
            <div class="layui-col-md10">
              <div class="list-group col LAY_wisdom_scroll" id="LAY_product_center_view"></div>

              <script type="text/html" id="LAY_product_center_tpl">
                {{# if (d.length) { }}
                {{# layui.each(d, function(index, item){ }}
                <div class="list-group-item LAY_wisdom_list_warp" data-code="{{item.productCode}}"
                     data-name="{{item.productName}}" data-sort="">
                  <div class="LAY_wisdom_list_item{{item.active ? ' active' : ''}}">
                    {{item.productName}}
                  </div>
                  <div class="LAY_wisdom_list_btn_group">
                    <div class="LAY_wisdom_list_btn_up LAY_product_center_btn_up" data-code="{{item.productCode}}"
                         data-index="{{index}}">
                      <i class="layui-icon layui-icon-up"></i>
                    </div>
                    <div class="LAY_wisdom_list_btn_delete LAY_color_red LAY_product_center_btn_delete"
                         data-code="{{item.productCode}}">
                      <i class="layui-icon layui-icon-delete"></i>
                    </div>
                    <div class="LAY_wisdom_list_btn_down LAY_product_center_btn_down" data-code="{{item.productCode}}"
                         data-index="{{index}}">
                      <i class="layui-icon layui-icon-down"></i>
                    </div>
                  </div>
                </div>
                {{# }) }}
                {{# } else { }}
                <div class="LAY_empty">暂无数据</div>
                {{# } }}
              </script>
            </div>
          </div>
        </div>
        <div class="layui-col-md6">
          <div class="LAY_wisdom_title">
            <h3>产品库</h3>
            <!-- <button class="layui-btn LAY_hot_batch_add">一键添加</button> -->
          </div>

          <div class="LAY_wisdom_product_search">
            <form class="layui-form LAY_wisdom_product_search_form" lay-filter="LAY_wisdom_product_center_search_form">
              <input type="text" name="productName" placeholder="请输入产品名称" autocomplete="off" class="layui-input">
              <button lay-submit class="layui-btn" lay-submit lay-filter="LAY_wisdom_product_center_search_btn">
                <i class="layui-icon layui-icon-search"></i>
              </button>
            </form>
          </div>

          <div class="LAY_wisdom_list_view" id="LAY_wisdom_product_center_list_view"></div>

          <script type="text/html" id="LAY_wisdom_product_center_list_tpl">
            <form class="layui-form" lay-filter="LAY_wisdom_product_center_list_form">
              {{# if (d && d.length) { }}
              {{# layui.each(d, function(index, item){ }}
              <div class="LAY_wisdom_product_list_row">
                <div class="LAY_wisdom_product_list_checkbox LAY_wisdom_product_list_square"></div>
                <div class="LAY_wisdom_product_list_card">
                  {{item.productName}}
                </div>
                <div class="LAY_wisdom_product_list_button">
                  <button type="button" class="layui-btn LAY_product_center_add" data-name="{{item.productName}}"
                          data-code="{{item.productCode}}">
                    <i class="layui-icon layui-icon-addition"></i>
                  </button>
                </div>
              </div>
              {{# }) }}
              {{# } else { }}
              <div class="LAY_empty">暂无数据</div>
              {{# } }}
            </form>
          </script>
        </div>
      </div>

      <div class="layui-row layui-col-space20">
        <div class="layui-col-md6">
          <div class="layui-col-md10 layui-col-md-offset2">
            <button class="layui-btn layui-btn-primary LAY_btn_preview">查看金惠智保</button>
          </div>
        </div>
      </div>
    </div>
  </div>
</div>

<script type="text/html" class="LAY_custom_layer_code_temp">
  <div class="layui-row layui-col-space40 LAY_custom_layer_row">
    <div class="LAY_custom_layer_col">
      <div class="LAY_custom_layer_title">金惠智保公众号</div>
      <div class="LAY_custom_layer_code"><img src="./../src/style/res/jhzb.jpg"></div>
      <div class="LAY_custom_layer_tips">请微信扫码至金惠智保公众号完成预览</div>
    </div>
  </div>
</script>

<script>
  layui.use(['admin', 'form', 'laypage', 'laytpl', 'hot', 'qrcode', 'clipboard',
    'hotProductLibrary', 'center', 'centerProductLibrary', 'preview'
  ], function () {
    var $ = layui.$,
            admin = layui.admin,
            setter = layui.setter,
            view = layui.view,
            table = layui.table,
            laytpl = layui.laytpl,
            laypage = layui.laypage,
            element = layui.element,
            form = layui.form,
            hot = layui.hot,
            hotProductLibrary = layui.hotProductLibrary,
            center = layui.center,
            centerProductLibrary = layui.centerProductLibrary,
            preview = layui.preview;

    hot.init(function () {
      hotProductLibrary.init();
    });

    center.init(function () {
      centerProductLibrary.init();
    });

    initPreview();

    function initPreview() {
      var content =
              $('.LAY_btn_preview').off('click').on('click', function () {
                layer.open({
                  title: '金惠智保',
                  type: 1,
                  area: admin.screen() < 2 ? ['80%', '300px'] : ['600px', '500px'],
                  shadeClose: true,
                  content: $('.LAY_custom_layer_code_temp').text()
                });
              });
    }

  });
</script>